﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace BeniBastanYaratProject.Uye
{
    public partial class SiparisTakibi : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label5.Visible = false;
            Label5.Text = "";

            DBBaglantiDataContext dbaglanti = new DBBaglantiDataContext();
            string aktifUserKey = Membership.GetUser().ProviderUserKey.ToString();
            lblUyeAdi.Text = Membership.GetUser().UserName;
            lblUyeNo.Text = aktifUserKey.Substring(0, 6) + "########";
            Label5.Visible = false;
            Label5.Text = "";
            Label5.Font.Bold = true;


            if (Request.QueryString["sipid"] != null)
            {
                string gelenid = Request.QueryString["sipid"];
                var sorgu = (from detay in dbaglanti.SiparisDetaylaris
                             join siparis in dbaglanti.Siparislers on detay.SiparisID equals siparis.SiparisID
                             where siparis.SiparisID.ToString() == gelenid
                             join urun in dbaglanti.Urunlers on detay.UrunID equals urun.UrunID
                             select new { detay.SiparisID, urun.UrunAdi, detay.Adet, siparis.SiparisDurumu, siparis.SiparisTarihi , urun.UrunResmiOrjinal }).ToList();

                //var resimsorgu = (from detay in dbaglanti.SiparisDetaylaris
                //                  join siparis in dbaglanti.Siparislers on detay.SiparisID equals siparis.SiparisID
                //                  where siparis.SiparisID.ToString() == gelenid
                //                  join urun in dbaglanti.Urunlers on detay.UrunID equals urun.UrunID
                //                  select new { urun.UrunResmiOrjinal }).First();


                Repeater2.DataSource = sorgu;
                Repeater2.DataBind();
              
            }
            else
            {
                Label5.Text = " Bir Hata Meydana Geldi";
                Label5.Visible = true;

            }
        }
    }
}
